package com.bluenave.crm.core.domain;

import org.apache.commons.lang3.Validate;
import org.hibernate.annotations.ForeignKey;

import javax.persistence.*;
import java.io.Serializable;

/**
 * Created by IntelliJ IDEA.
 * User: aleksanderbrancewicz
 * Date: 7/24/11
 * Time: 5:51 PM
 * To change this template use File | Settings | File Templates.
 */

@Entity
public class Person implements Serializable{

    int id;
    String firstname = null;
    String surname = null;
    String sex = null;
    Company company = null;


    public Person() {
        super();
    }

    public Person(String firstname, String surname, String sex) {
        this.firstname = firstname;
        this.surname = surname;
        this.sex = sex;

    }

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY )
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getFirstname() {
        return firstname;
    }

    public void setFirstname(String firstname) {
        this.firstname = firstname;
    }

    public String getSurname() {
        return surname;
    }

    public void setSurname(String surname) {
        this.surname = surname;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }


    @ManyToOne(fetch = FetchType.LAZY)
    @ForeignKey(name = "COMPANY_ID")
    public Company getCompany() {
        return company;
    }

    public void setCompany(Company company) {
        this.company = company;
    }
}
